package backend.majiong.yaku.yaku;

import backend.MainGame;
import backend.majiong.Pai;
import backend.majiong.Player;
import backend.majiong.yaku.AbstractYaku;
import backend.majiong.yaku.HandCombo;

public class Syousangen extends AbstractYaku {

    @Override
    public boolean checkYaku(Player player, HandCombo combo, MainGame mainGame) {
        if (!combo.getDuiZi().isSanYuan()) {
            return false;
        }
        int count = 0;
        for (Pai pai : combo.getKeZi()) {
            if (pai.isSanYuan()) {
                count++;
            }
        }
        for (Pai pai : combo.getGangZi()) {
            if (pai.isSanYuan()) {
                count++;
            }
        }
        if (count == 2) {
            return true;
        }
        return false;
    }

    @Override
    public String getYakuName() {
        return "小三元";
    }

    @Override
    public Integer getYakuNum(boolean isMenQing) {
        return 2;
    }

}
